package model;

import java.util.Random;

public class Factory {
	
	double minDown = 50;
	double maxDown = 1000;
	double minUp = 25;
	double maxUp = 200;
	Random random = new Random();
	
	public Tracker getSystem(){
		Tracker tracker = new Tracker();
		Node seed1 = new Node(tracker, tracker.getFile(), getDown(), getUp(), false, true, 1.1);
		Node seed2 = new Node(tracker, tracker.getFile(), getDown(), getUp(), false, true, 1.1);
		
		Node peer1 = new Node(tracker, tracker.getFile(), getDown(), getUp(), false, false, 1.1);
		Node peer2 = new Node(tracker, tracker.getFile(), getDown(), getUp(), false, false, 1.1);
		
		Node leech1 = new Node(tracker, tracker.getFile(), getDown(), getUp(), true, false, 1.1);
		Node leech2 = new Node(tracker, tracker.getFile(), getDown(), getUp(), true, false, 1.1);
		
		tracker.addNode(seed1);
		tracker.addNode(seed2);
		tracker.addNode(peer1);
		tracker.addNode(peer2);
		tracker.addNode(leech1);
		tracker.addNode(leech2);
		
		
		return tracker;
	}
	
	private double getDown(){
		return random.nextDouble()*(maxDown-minDown) + minDown;
	}
	
	private double getUp(){
		return random.nextDouble()*(maxUp-minUp) + minUp;
	}

}
